<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<!DOCTYPE>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>联系电话</title>
<script type="text/javascript">
function checkPhone(){
	document.getElementById("error").innerHTML="";
	var userPhone=$("#userPhone").val();
	$.ajax({
		type:'post',
		url:'user_checkPhone',
		data:{userPhone:userPhone},
		dataType:'json',
		success:function(data){
	          // alert(data[0].msg);
	         // $("#error").val(data[0].msg);
	         if(data[0].msg=="1"){
	        	 document.getElementById("error").innerHTML="<span style='color:red'>该电话已被注册</span>";
		         }else{
		        	 document.getElementById("error").innerHTML="<span style='color:green'>该电话可以使用</span>";
			         }
	          
			}
			
	});
}

</script>
</head>
<body>
<form action="user_updatePhone" method="post" id="save">
<s:hidden name="userId" value="%{user.userId}"></s:hidden>
<div style="width: 510px;height: 30px;">
<div style="width: 300px;height: 30px;float:left;">联系方式：<s:textfield name="userPhone" placeholder="请输入联系方式" style="width:70%;height:30px;" onblur="checkPhone()" id="userPhone" theme="simple"></s:textfield></div>
<div style="width: 200px;height: 30px;float: left;" id="error"></div>
</div>
</form>
</body>
</html>